/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * LibraryPage.java
 *
 * Created on 07 14, 12, 2:59:28 PM
 */
package malateproject;

import javax.swing.JOptionPane;

/**
 *
 * @author Aeron
 */
public class LibraryPage extends javax.swing.JFrame {

    /** Creates new form LibraryPage */
    public LibraryPage() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jButtonBorrow = new javax.swing.JButton();
        jButtonLibLogs = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButtonReturn = new javax.swing.JButton();
        jButtonRenew = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jListBooks = new javax.swing.JList();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(null);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("The Library");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(120, 50, 120, 50);

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Your Fee is P");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(60, 270, 120, 30);

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Your/Currently borrowed Books");
        getContentPane().add(jLabel4);
        jLabel4.setBounds(310, 30, 230, 30);

        jButtonBorrow.setText("Borrow Book");
        getContentPane().add(jButtonBorrow);
        jButtonBorrow.setBounds(110, 130, 120, 23);

        jButtonLibLogs.setBackground(new java.awt.Color(255, 255, 255));
        jButtonLibLogs.setText("View Library Logs");
        jButtonLibLogs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLibLogsActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonLibLogs);
        jButtonLibLogs.setBounds(110, 170, 120, 23);

        jButton3.setText("Update Library");
        getContentPane().add(jButton3);
        jButton3.setBounds(110, 210, 120, 23);

        jButtonReturn.setText("Return Book");
        jButtonReturn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonReturnActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonReturn);
        jButtonReturn.setBounds(350, 280, 120, 23);

        jButtonRenew.setText("Renew Book");
        jButtonRenew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRenewActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonRenew);
        jButtonRenew.setBounds(350, 310, 120, 23);

        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });
        getContentPane().add(jTextField1);
        jTextField1.setBounds(180, 270, 90, 30);

        jListBooks.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(jListBooks);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(340, 70, 150, 200);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/MalateBG.E-res.jpg"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, 0, 580, 360);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1ActionPerformed

    private void jButtonReturnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonReturnActionPerformed
        // TODO add your handling code here:
            if(jListBooks.getSelectedValue().equals(null))
                JOptionPane.showMessageDialog(null, "Please select a book from the list");
            else
            {
                //database part of return book
                JOptionPane.showMessageDialog(null, "Book has been returned");
            }
    }//GEN-LAST:event_jButtonReturnActionPerformed

    private void jButtonRenewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRenewActionPerformed
        // TODO add your handling code here:
        
          if(jListBooks.getSelectedValue().equals(null))
                JOptionPane.showMessageDialog(null, "Please select a book from the list");
            else
            {
                //database part of return book
                JOptionPane.showMessageDialog(null, "Book has been renewed");
            }
    }//GEN-LAST:event_jButtonRenewActionPerformed

    private void jButtonLibLogsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLibLogsActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        //page for library logs
    }//GEN-LAST:event_jButtonLibLogsActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(LibraryPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(LibraryPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(LibraryPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(LibraryPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new LibraryPage().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButtonBorrow;
    private javax.swing.JButton jButtonLibLogs;
    private javax.swing.JButton jButtonRenew;
    private javax.swing.JButton jButtonReturn;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JList jListBooks;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables
}
